<?php
  include_once dirname(__FILE__)."/database/database.class.php";
  include_once dirname(__FILE__)."/database/card.database.class.php";
  include_once dirname(__FILE__)."/includes/print_images.inc.php";
  include_once dirname(__FILE__)."/classes/card.class.php";
  
  if(isset($_GET['cardid']) && is_numeric($_GET['cardid']))
  {
    $card = new Card($_GET['cardid']);
  }
  else
  {
    $card = new Card($cdb->getXthCard(rand(0, $cdb->getTotalCards()-1)));
  }
  
  $scroller_initializing_position = ($card->getDetails()->details[0]->cardnumber - 1);
?>

<!DOCTYPE html>
<html>

<head>
	<meta http-equiv="Content-type" content="text/html;charset=utf-8">
	<title>Magic the Gathering Card Collection Tool</title>
  <link rel="stylesheet" type="text/css" href="./styles/default.css">
  <link rel="stylesheet" type="text/css" href="./styles/menu.css">
  
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
  <script src="./scripts/card_scroller.js" type="text/javascript"></script>
  <script src="./scripts/switchCardSide.js" type="text/javascript"></script>
  <script type="text/javascript" src="./scripts/resize_card_inner.js"></script>
  <script type="text/javascript" src="./scripts/update_collection.js"></script>
  
    <script type="text/javascript">
    var scroller;

    function create_scroller(divname, url, GET_parameters)
    {
      scroller = new CardScroller(divname, url, GET_parameters);
      scroller.setDirection("vertical");
      scroller.initialize_cards(<?php echo $scroller_initializing_position;?>);
    }
  </script>
</head>

<body onload="create_scroller('card_container', './php_scripts/getCards.php', {id: <?php echo $card->getExpansion("id"); ?>, type: 'expansion'});">
<?php
  include dirname(__FILE__)."/includes/header.inc.php";
  include dirname(__FILE__)."/includes/menu.inc.php";
?>

<?php
  include dirname(__FILE__)."/includes/card.inc.php";
  include dirname(__FILE__)."/includes/footer.inc.php";
?>
</body>‎

</html>
